<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            position: fixed;
            top: 0px;
            left: 0px;
            right: 0px;
            bottom: 0px;
            background-color: rgba(0, 0, 0, 0.4);
        }
        .content{
            background-color: white;
            width: 300px;
            height: 200px;
            box-shadow: 0 0 6px #333;
            position: absolute;
            top: 60px;
            left: 50%;
            transform: translate(-50%,0);
        }
    </style>
</head>
<body>
    <div id="app">
        
        <input type="button" value="open" @click="openBox()">

        <div class="box" v-show="flag" @click="closeBox()">
            <div class="content" @click.stop>
                <input type="text">
                <hr>
                <input type="button" value="关闭" @click="closeBox()">
            </div>
        </div>

    </div>
    <script type="module">
        import { createApp } from "../../assets/vue3/vue.esm-browser.js";
        createApp({
            data(){
                return {
                   flag:false
                }
            },
            methods:{
                openBox(){
                    this.flag = true;
                },
                closeBox(){
                    this.flag = false;
                }
            }
        }).mount("#app");
    </script>
</body>
</html>